package cn.leedsoft.and.crimeintent.controller.photo_gallery;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

/**
 * Created by leeds on 2016/9/2 10:25.
 */
public class StartupReceiver extends BroadcastReceiver{
    private static final String TAG = "StartupReceiver";
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d(TAG, ">>>>>>>>>received an broadcast intent :" + intent);

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);//涉及权限的问题。MIUI 要求应用取得自启动权限后，才可以接收到自启动广播消息。
        boolean toOpen = prefs.getBoolean(PollService.POLL_ALARM_STATE, false);
        PollService.setAlarmService(context, toOpen);
    }
}
